<%@page import="com.qmerak.entity.MemberEntity"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户编辑</title>
<link rel="stylesheet" type="text/css"
	href="../../css/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../../css/themes/icon.css" />
<script type="text/javascript" src="../../js/jquery-1.7.2.js"></script>
<script type="text/javascript"
	src="../../js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../js/ListData.js"></script>
<div id="LP" style="display: none;"><%=((MemberEntity) request.getSession().getAttribute(
					"cur_user")).getLoginPWD()%></div>
<script type="text/javascript">
	$(function() {
	})
	$.extend($.fn.validatebox.defaults.rules, {
		pwd : {
			validator : function(value, param) {
				return value == $("#LP").text();
			},
			message : '密码错误，请确认后重新输入！'
		}
	});
	$.extend($.fn.validatebox.defaults.rules, {
		dbClickCheck : {
			validator : function(value, param) {
				return value == $("#newpwd").val();
			},
			message : '两次输入不同，请确认后重新输入！'
		}
	});
	function checkOldPWD(e) {
		if (e.value == $("#LP").text()) {
			$("#newpwd").removeAttr("disabled");
			$("#renewpwd").removeAttr("disabled");
		}
	}
	function dbClickCheck(e) {
		if (e.value == $("#newpwd").val()) {
			$("#submitBTN").removeAttr("disabled");
		}
	}
	function confirm() {
		$.post("../../member/modifypwd", {
			newpwd : $("#newpwd").val()
		}, function() {
			alert("提交成功！");
		});
	}
</script>
<style type="text/css">
body {
	text-align: center;
	margin: 0px;
	padding: 0px;
	width: 100%;
	height: 100%;
}
</style>
</head>
<body style="margin: 0">
	<form id="member_info" name="member_info" method="post">
		<table width="100%" height="45" border="0" align="center"
			cellpadding="0" cellspacing="0">
			<tr>
				<td width="88%" align="center" class="test_bt">修改密码</td>
			</tr>
		</table>
		<table align="center">
			<tr>
				<td nowrap="nowrap" width="100" align="right">请输入旧密码：</td>
				<td nowrap="nowrap" width="200" align="left" colspan="3"><input
					id="oldpwd" name="oldpwd" type="password" style="width: 200px;"
					class="easyui-validatebox"
					data-options="required:true,validType:'pwd'"
					onkeyup="checkOldPWD(this)"></td>
			</tr>
			<tr>
				<td nowrap="nowrap" width="100" align="right">请输入新密码：</td>
				<td nowrap="nowrap" width="200" align="left" colspan="3"><input
					id="newpwd" name="newpwd" type="password" style="width: 200px;"
					disabled="disabled"></td>
			</tr>
			<tr>
				<td nowrap="nowrap" width="100" align="right">请确认信密码：</td>
				<td nowrap="nowrap" width="200" align="left" colspan="3"><input
					id="renewpwd" name="renewpwd" type="password" style="width: 200px;"
					class="easyui-validatebox"
					data-options="required:true,validType:'dbClickCheck'"
					disabled="disabled" onkeyup="dbClickCheck(this)"></td>
			</tr>
			<tr>
				<td colspan="4" align="left"></td>
			</tr>
			<td colspan="4" align="center">
				<button id="submitBTN" name="submitBTN" type="button"
					onclick="confirm()" disabled="disabled">提交修改</button>
			</td>
			</tr>
		</table>
	</form>
</body>
</html>